
<?php
require 'db.php';
if(isset($_POST['masv']))$masv=$_POST['masv'];
$sql="SELECT dbo_monhoc.MaMH, TenMH, SoTC, NienKhoa, HocKy FROM dbo_kehoachhttk, dbo_sinhvien, dbo_monhoc ";
$sql.=" WHERE dbo_kehoachhttk.MaMH=dbo_monhoc.MaMH and dbo_sinhvien.MaSV=dbo_kehoachhttk.MaSV and dbo_sinhvien.MaSV=:masv and NienKhoa=:nk and HocKy=:hk ";
$stmt = $db->prepare($sql);
$stmt->bindParam(":hk",$hocky,PDO::PARAM_STR);
$stmt->bindParam(":nk",$nienkhoa,PDO::PARAM_STR);
$stmt->bindParam(":masv",$masv,PDO::PARAM_STR);
$stmt->execute();
$sql3="SELECT dbo_sinhvien.MaSV,Holot, Ten, MaLop FROM dbo_sinhvien WHERE dbo_sinhvien.MaSV=:masv";
$stmt2 = $db->prepare($sql3);
$stmt2->bindParam(":masv",$masv,PDO::PARAM_STR);
$stmt2->execute();
$r3=$stmt2->fetch();

?>
<hr ></hr>

<table  class="table table-bordered table-hover">
	
			<thead>
				<div class="row">
				<div class="col-md-12 text-center">
				<p class="form-group alert-info"><label>MSSV :</label><span><?php echo $r3['MaSV'];?></span> <label><?php echo "  -  "?>Họ và tên :</label><span><?php echo $r3['Holot']." ".$r3['Ten']."  -  ";?></span>
				<label>Mã lớp :</label><span><?php echo $r3['MaLop'];?></span>
			</p> </div></div>
			<tr class="info"><th>STT</th><th>Mã học phần</th><th>Tên học phần</th><th>Số tín chỉ</th><th>Năm học</th><th>Học kỳ</th><th>Cập nhật</th></tr></thead>
			<tbody>
	<?php $i=1;
	
		if($stmt->execute()){
			
				while($r=$stmt->fetch()){
?>
				
				<tr>
					<td><?php echo $i++;?></td>
					<td><?php echo $r['MaMH'];?></td>
					<td><?php echo $r['TenMH'];?></td>
					<td><?php echo $r['SoTC'];?></td>
					<td><select name="ChonNK"  id="ChonNK" class="form-control">
			</option>
			<option ><?php echo $r['NienKhoa'];?></option>
			</select></td>
					<td><select name="ChonHK"  id="ChonHK" class="form-control"><option><?php if($r['HocKy']=='3') echo "Hè"; else echo $r['HocKy'];?></option></select></td>
					<td><input type='checkbox' name='checkKHHT' id='checkKHHT'/><a class="editKHHT" id="btneditKHHT" ><span class="glyphicon glyphicon-pencil"></span></a></td>
		<?php }} ?>	
			</tbody>
			<tr>
			<td colspan="7">
			<a href="#" class="btn btn-primary" id="btnSave"><span class="glyphicon glyphicon-save">Lưu</span></a>
			</td>
			</tr>
			</table>